package com.jic.manager.api.manage;

import com.jic.common.base.vo.RestResult;
import com.jic.manager.request.ChildNameRequest;
import com.jic.manager.request.MerchantRequest;
import com.jic.manager.request.SaveDeptListRequest;
import com.jic.manager.request.SysDeptRequest;
import com.jic.manager.request.orgcenter.SysDeptTreeRequest;
import com.jic.manager.response.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author wwb
 * feignClient  使用方法:
 * <p>
 * 1.服务提供者编写 FeignClient 属性 name对应注册中心服务Id path为统一前缀  url可以直接指定调用地址（调试用）
 * 2.客户端需要在启动类上加上@EnableFeignClients注解
 * 3.如果通过feignClient调用超时，请设置
 * ribbon:
 * ReadTimeout: 3000
 * ConnectTimeout: 3000
 * 4.客户端依赖该jic-feign-common,在调用处@Resource注解注入 即可调用
 * @date: 2020-01-09
 * @remark: 商品后台管理系统的服务接口
 */
@FeignClient(name = "jic-manager", path = "/dept")
public interface SysDeptApi {

    /**
     * 批量保存组织架构
     *
     * @param saveDeptListRequestList pBusinessId
     * @return
     */
    @PostMapping("saveDeptList")
    RestResult<Boolean> saveDeptList(@RequestBody SaveDeptListRequest saveDeptListRequestList);

    @PostMapping("queryDeptNameById")
    RestResult<String> queryDeptNameById(@RequestParam("deptId") Long deptId);

    @PostMapping("queryChildListById")
    List<Long> queryChildListById(Long deptId);

    @PostMapping("updateMerchantScopeApplicationById")
    RestResult<Long> updateMerchantScopeApplicationById(MerchantRequest merchantRequest);

    @PostMapping("getGrowhtScopeInfo")
    MemMerchantInfoResponse getGrowhtScopeInfo(@RequestBody Long merchantId);

    @PostMapping("querymMerchantOrStoreListByName")
    List<Long> querymMerchantOrStoreListByName(String name);

    @PostMapping("getDeptIdByMsName")
    RestResult<Long> getDeptIdByMsName(String msName);

    @PostMapping("queryChildNameByDeptId")
    RestResult<String> queryChildNameByDeptId(ChildNameRequest childNameRequest);

/*
    @PostMapping("querymMerchantOrStoreListById")
    List<Long> querymMerchantOrStoreListById(Long deptId);
*/

    @PostMapping("query")
    List<SysDeptResponse> query(@RequestBody SysDeptRequest sysDept);

    @PostMapping("getDeptIdByMsId")
    public Long getDeptIdByMsId(SysDeptRequest sysDept);

    @PostMapping(value = "/getDeptList")
    public RestResult<List<SysDeptResponse>> getDeptList(@RequestBody SysDeptTreeRequest sysDeptTreeRequest);

    @PostMapping("/getUccUserAuthorNew")
    RestResult<List<Long>> getUccUserAuthorNew(@Param("userId") Long userId);

    @PostMapping("/getDeptIdsByStroreIdOrMerchantIdAndType")
    RestResult<List<Long>> getDeptIdsByStroreIdOrMerchantIdAndType(@RequestParam("businessIds") List<Long> businessIds, @RequestParam("deptType") Integer deptType);

    @PostMapping("/queryUserInfoByAccessToken")
    UccUserOutputDTO queryUserInfoByAccessToken(@Param("accessToken") String accessToken);

    @PostMapping(value = "/getStoreInfoByDeptId")
    RestResult<MemStoreResponse> getStoreInfoByDeptId(@RequestBody SysDeptRequest sysDeptRequest);

    @PostMapping(value = "/getStoreInfo")
    RestResult<List<MemStoreResponse>> getStoreInfo();
    @GetMapping(value = "/getId")
    SysDeptResponse getByIdPid(@RequestParam("id") Long id);
    @PostMapping(value = "/getMerchantByDeptId")
    RestResult<MerchantResponse> getMerchantByDeptId(@RequestBody SysDeptRequest  sysDeptRequest);

}
